<?php
/**
 * Created by PhpStorm.
 * User: fangwei
 * Date: 2019-06-23
 * Time: 21:08
 */

namespace App\Http\Controllers\Admin\View;


use App\Http\Controllers\Controller;
use App\Http\Repositories\Services\IPermission;

class PermissionController extends Controller
{
    protected $permissionService;

    public function __construct(IPermission $permissionService)
    {
        $this->permissionService = $permissionService;
    }

    public function index(){
        return view('admin.permission.index');
    }

    public function store($pid){
        $tree = $this->permissionService->getAll();
        return view('admin.permission.create',['tree'=>$tree,'pid'=>$pid]);
    }

    public function update($id){
        $tree = $this->permissionService->getAll();
        $dao = $this->permissionService->byId($id)->toArray();
        return view('admin.permission.edit',['tree'=>$tree,'dao'=>$dao]);
    }





}